﻿<{include file="header.htm"}>
<link href="<{$config.weburl}>/templates/default/css/booking.css" rel="stylesheet" media="screen" type="text/css" />
<script src="<{$config.weburl}>/templates/default/js/layer/layer.min.js"></script>
<script language="javascript" type="text/javascript" src="<{$config.weburl}>/templates/default/js/jquery.validate.js"></script>
        <div class="width_1210">
            <div class="top_first"> </div>
            <!--订单页面-->
            <div class="order_con" >
                <form id="order_form" action="<{$config.weburl}>/?m=product&s=shop_order" method="post" onsubmit=" return check_data();">
                    <input type="hidden" name="act" value="order"/>
                    <div class="order_left">
                        <div class="order_data_con">
                            <div class="liuc"><img class="fl" src="<{$config.weburl}>/templates/default/images/liucheng.gif"/></div>

                            <div class="cp_num_con">
                                <dl>
                                    <dt>
                                        <span>名称</span>
                                        <span>日期</span>
                                        <span>单价</span>
                                        <span>购买数量</span>
                                        <span>金额</span>
                                    </dt>
                                    <dd>
                                        <{foreach item=vo from=$product_list}>
                                        <ul>
                                            <li><{$vo.pname|truncate:20:'...'}></li>
                                            <li><{$vo.performance_start_time|date_format:"%Y-%m-%d"}></li>
                                            <li><{$vo.price}></li>
                                            <li>
                                                <input type="hidden" name="product_id[]" value="<{$vo.id}>"/>
                                                <{if $parent_product.is_seat eq 1}>
                                                <input type="text" class="gm_num" name="num[]"  value="<{$vo.buy_num}>" data-price="<{$vo.price}>" data-stock="<{$vo.stock}>" readonly />
                                                <{elseif $parent_product.buy_limit gt 0}>
                                                <input type="text" class="gm_num" name="num[]"  value="<{$vo.buy_num}>" data-price="<{$vo.price}>" data-stock="<{$vo.stock}>" readonly />
                                                <{else}>
                                                <span class="down">-</span>
                                                <input type="text" class="gm_num" name="num[]"  value="<{$vo.buy_num}>" data-price="<{$vo.price}>" data-stock="<{$vo.stock}>" readonly />
                                                <span class="up">+</span>
                                                <{/if}>
                                            </li>
                                            <li>&yen;<span class="singleprice"><{$vo.price}></span></li>
                                        </ul>
                                        <{/foreach}>
                                    </dd>
                                </dl>
                            </div>


                            <!--是否配送方式-->
                            <div class="zhifu_fs order3">
                                <h3>配送方式</h3>
                                <ul>
                                    <li class="h1">
                                        <div class="i1 kdps"><img src="<{$config.weburl}>/templates/default/images/kdps.jpg" /></div>
                                        <{if $parent_product.is_door_self == 1 }>
                                        <div class="i1 smqp"><img src="<{$config.weburl}>/templates/default/images/smqp.jpg" /></div>
                                         <{/if}>
                                    </li>
                                    
                                    <li class="h2">
                                        <div class="i1 express_way"><input type="radio" name="delivery_way" checked="checked" value="express"/></div>
                                         <{if $parent_product.is_door_self == 1 }>  
                                        <div class="i1 pickup_way"><input type="radio" name="delivery_way"  value="pickup"/></div>
                                         <{/if}>
                                    </li>
                                   
                                </ul>
                            </div>
                            <{if $parent_product.is_real_name == 1}>
                            <div class="yd_msg" >
                                <h3>实名制信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>姓名：</dt>
                                        <dd><input type="text" class="msg_text_two" name="real_user_name" id="real_user_name" value="<{$card_check.real_user_name}>" /></dd>
                                    </dl>
                                    <dl>
                                        <dt>证件类型：</dt>
                                        <dd>
                                            <select name="real_card_type" id="real_card_type"  class="msg_text_two" style=" width: 305px; height: 30px; line-height: 30px;">
                                                <option value="1" <{if $card_check.real_card_type == 1 }> selected <{/if}> >身份证</option>
                                                <option value="2" <{if $card_check.real_card_type == 2 }> selected <{/if}> >护照</option>
                                            </select>
                                        </dd>
                                    </dl>
                                    <dl>
                                        <dt>证件号码：</dt>
                                        <dd><input type="text" class="msg_text_two" name="real_card_no" id="real_card_no" value="<{$card_check.real_card_no}>" /></dd>
                                    </dl>


                                </div>
                            </div>
                            <{/if}>


                            <div class="yd_msg" id="is_exp">
                                <h3>收货信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>收货人：</dt>
                                        <dd><input type="text" name="ship_name" id="ship_name" class="msg_text" value="<{$consignee.name}>" /><span>（*此处可输入收件人姓名)</span></dd>
                                    </dl>
                                    <dl>
                                        <dt>联系手机：</dt>
                                        <dd><input type="text" class="msg_text" name="ship_mobile" id="ship_mobile" value="<{$consignee.mobile}>" /></dd>
                                    </dl>

                                    <dl>
                                        <dt>省市区：</dt>
                                        <dd>
                                            <select name="provinceid" id="provinceid"  class="msg_text" style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{foreach item=vo from=$prov}>
                                                <option value="<{$vo.id}>" <{if $vo.id == $consignee.provinceid}> selected <{/if}> ><{$vo.name}></option>
                                                <{/foreach}>
                                            </select>

                                            <select name="cityid" id="cityid"  class="msg_text"  style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.cityid)}>
                                                <option value="<{$consignee.cityid}>" selected><{$consignee.cityid|get_city_name}></option>
                                                <{/if}>
                                            </select>

                                            <select name="areaid" id="areaid"  class="msg_text">
                                                <option value="">请选择</option>
                                                <{if  !empty($consignee.areaid)}>
                                                <option value="<{$consignee.areaid}>" selected><{$consignee.areaid|get_city_name}></option>
                                                <{/if}>
                                            </select>
                                        </dd>
                                    </dl>

                                    <dl>
                                        <dt>街道地址：</dt>
                                        <dd><textarea class="msg_area" name="ship_addr" id="ship_addr" cols="" rows=""><{$consignee.address}></textarea><span>（*此处可输入收件地址或备注信息等)</span></dd>
                                    </dl>
                                </div>
                            </div>

                              <div class="yd_msg" id="is_door" style="display: none;">
                                <h3>取票信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>取票人：</dt>
                                        <dd><input type="text" name="pick_name" id="pick_name" class="msg_text" value="" /><span>（*此处可输入取票人姓名)</span></dd>
                                    </dl>
                                    <dl>
                                        <dt>联系手机：</dt>
                                        <dd><input type="text" class="msg_text" name="pick_mobile" id="pick_mobile" value="" /></dd>
                                    </dl>

                                    <dl>
                                        <dt>取票城市：</dt>
                                        <dd>
                                            <select name="pick_provinceid" id="pick_provinceid"  class="msg_text" style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <{foreach item=vo from=$pickup_city}>
                                                <option value="<{$vo.id}>" ><{$vo.city_name}></option>
                                                <{/foreach}>
                                            </select>
                                        </dd>
                                    </dl>

                                    <dl>
                                        <dt>取票地址：</dt>
                                        <dd><textarea class="msg_area" name="pick_addr" id="pick_addr" cols="" rows=""></textarea><span>温馨提示：（*请持订票人身份证原件上门自取，代领需出示订票人以及代领人身份证原件)</span></dd>
                                    </dl>
                                </div>
                            </div>

                            <!--电子票信息-->
                            <{if $parent_product.is_electronic_ticket == 1}>
                            <div class="yd_msg">
                                <h3>电子票信息<span></span></h3>
                                <div class="msg_con">
                                    <dl>
                                        <dt>身份证：</dt>
                                        <dd><input type="text" name="id_card" id="id_card" class="msg_text" value="" /></dd>
                                    </dl>
                                    <dl>
                                        <dt>学生证：</dt>
                                        <dd><input type="text" class="msg_text" name="student_card" id="student_card" value="" /></dd>
                                    </dl>

                                </div>
                            </div>
                            <{/if}>

                            <!--支付方式-->
                            <div class="zhifu_fs">
                                <h3>支付方式</h3>
                                <div class="fs_con">
                                    <dl>
                                        <dt>在线支付方式</dt>
                                        <dd>
                                            <ul>
                                                <li>
                                                <label>
                                                    <em><img class="fl" src="<{$config.weburl}>/templates/default/images/zfb_ico.gif" alt="支付宝" /></em>
                                                    <span>即时到账</span>
                                                    <input type="radio" name="pay_type" checked value="alipay">
                                                </label>
                                            </li>
                                                <!--<li>-->
                                                <!--<label>-->
                                                    <!--<em><img class="fl" src="<{$config.weburl}>/templates/default/images/tenpay.gif" alt="财付通" width="120px" /></em>-->
                                                    <!--<span>财付通</span>-->
                                                    <!--<input type="radio" name="pay_type" value="tenpay">-->
                                                <!--</label>-->
                                            <!--</li>-->
                                                <!--<li>-->
                                                <!--<label>-->
                                                    <!--<em><img class="fl" src="<{$config.weburl}>/templates/default/images/cbp.gif" alt="网银在线" width="120px" /></em>-->
                                                    <!--<span>网银在线</span>-->
                                                    <!--<input type="radio" name="pay_type" value="cbp" data-type="网银在线">-->
                                                <!--</label>-->
                                                <!--</li>-->

                                                <!--<li>-->
                                                    <!--<label>-->
                                                        <!--<em><img class="fl" src="<{$config.weburl}>/templates/default/images/zfb_ico.gif" alt="货到付款" width="120px" /></em>-->
                                                        <!--<span>货到付款</span>-->
                                                        <!--<input type="radio" name="pay_type" value="cod" data-type="货到付款">-->
                                                    <!--</label>-->
                                                <!--</li>-->

                                            </ul></dd></dl>
                                </div>
                            </div>
                            <!--支付方式end-->
                            <div class="yd_msg" id="send_ticket" style="display: none;">
                                <h3>发票信息<span></span></h3>
                                <div class="msg_con">
                                    <span style="color:#e77817">温馨提示：如需报销发票，将在演出/活动结束后统一由演出主办方按照订单票面实际金额开具。以快递到付的形式送达。中国大陆以外地区演出/活动无法提供发票。</span>
                                    <dl>
                                        <dt>类型</dt>
                                        <dd>


                                            <select name="invoice_type" id="invoice_type"  class="msg_text" style="margin-right: 5px;">
                                                <option value="">请选择</option>
                                                <option value="1">个人</option>
                                                <option value="2">企业</option>

                                            </select>


                                        </dd>
                                    </dl>
                                    <div style="display: none;" id="show_invoice_detail">
                                        <dl>
                                            <dt>发票抬头</dt>
                                            <dd><input type="text" class="msg_text"  name="invoice_company" value="" /></dd>
                                        </dl>

                                        <dl>
                                            <dt>寄票地址：</dt>
                                            <dd>
                                                <textarea class="msg_area"  name="invoice_addr" ></textarea>

                                            </dd>
                                        </dl>

                                    </div>


                                </div>
                            </div>
                            <!--订单金额-->
                            <div class="order_money">
                                <p><em>我要开发票: <input type="checkbox" name="send_invoice" value="1" /> </p>
                                <!--<p><em>验证码：<input class="cd-txt" name="checkcode" value="" id="yzm_code" type="text"/><img  class="wd_yzm" src="<{$config.weburl}>/includes/rand_func.php?rand=<{$now_time}>" width="80" height="30"  onclick="this.src = '<{$config.weburl}>/includes/rand_func.php?rand=' + Math.random()" /></em></p>-->
                                <p><em>座位:</em>
                                    <{foreach item=vo from=$product_list}>


                                    <input type="hidden" name="spot_model_id[]" value=<{$vo.un_seat_model_id}> />
                                    <input type="hidden" name="seat_seat_row[]" value=<{$vo.un_seat_seat_row}> />
                                    <input type="hidden" name="seat_seat_cols[]" value=<{$vo.un_seat_seat_cols}> />

                                    <{if empty($vo.seat_model_id) || empty($vo.seat_seat_row) || empty($vo.seat_seat_cols) }>
                                    择优分配位置
                                          <{else}>
                                    <{foreach item=seat from=$vo.seat_model_id key=k}>

                                    ￥<{$vo.price}>(<{$seat|get_spot_model_name}><{$vo.seat_seat_row[$k]}>排<{$vo.seat_seat_cols[$k]}>座)&nbsp;
                                    <{/foreach}>
                                    <{/if}>
                                    <{/foreach}>

                                </p>
                                <{if $points > 0}>
                                <p><em>积分抵扣: <input type="checkbox" name="cost_point" value="<{$points}>" /> <{$points}> 元</em></p>
                               <{/if}>
                                <p><em>订单金额：&yen;<span class="totalprice" id="totalprice"><{$total_price}></span>元</em></p>

                                <p> <em><input type="checkbox" name="agreement" value="1" checked /> 我已阅读并同意 <a href="<{$config.weburl}>/help.php?action=detail&con_id=19" style="color: #0A8CD2;">海峡票务用户服务协议</a></em> </p>

                            </div>


                            <!--预定按钮-->
                            <div class="tj_btn_order">
                                <input type="hidden" name="spot_id" value="<{$spot_id}>" />
                                <a href="javascript:;" class="btnsaveorder">提交订单</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script type="text/javascript">

            function get_total_price(){
                var total_price = parseFloat(0);
                $(".cp_num_con").find('.gm_num').each(function(i){
                    num = $(this).val();
                    price = $(this).attr('data-price');
                    sing_price = parseInt(num)*parseFloat(price);
                    $(this).parent().next().find(".singleprice").html(sing_price.toFixed(2));
                    total_price = total_price + sing_price;
                });
                $("#totalprice").html(total_price.toFixed(2));
            }

            $("#provinceid").on('change',function(){
                var provinceid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:provinceid},function(ret){
                     ret = eval('('+ret+')');
                     $("#cityid").html(ret.content);
                });
            });
            $("#cityid").on('change',function(){
                var cityid = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{action:'get_city',id:cityid},function(ret){
                     ret = eval('('+ret+')');
                     $("#areaid").html(ret.content);
                });
            });
            $("#invoice_person").on('click',function(){
                $("#invoice_head").hide();
            });
            $("#invoice_company").on('click',function(){
                $("#invoice_head").show();
             });

 //选择发票
    $("#invoice_type").on("change",function(){
        if( '' != $(this).val()) {
            $("#show_invoice_detail").show();
        } else {
            $("#show_invoice_detail").hide();
        }
    });

//上门取票
$("[name='delivery_way']").on('click',function(){
    var is_door_value = $(this).val();
    if(is_door_value == 'pickup'){
        $("#is_door").show();
        $("#is_exp").hide();
    } else {
        $("#is_exp").show();
        $("#is_door").hide();
        $("#pick_name").val('');
        $("#pick_mobile").val('');
        $("#pick_provinceid").val('');
        $("#pick_addr").val('');
    }
});
            //选择取票城市
            $("[name='pick_provinceid']").on('change',function(){
                var id = $(this).val();
                $.post("<{$config.weburl}>/ajax.php",{id:id,action:"pick_city_info"},function(ret){
                    ret = eval('('+ret+')');
                    $("#pick_addr").val(ret.msg);
                });
            });

            //开发票
            $("[name='send_invoice']").on("click",function(){
                if($(this).is(":checked")){
                    $("#send_ticket").show();
                } else {
                    $("#send_ticket").hide();
                }
            });



         //增加数量
            $(".up").on('click',function(){
                stock = $(this).prev().attr('data-stock');
                value = $(this).prev().val();
                up_value = parseInt(value) + 1;
                if(up_value <= stock ){
                    $(this).prev().val(up_value)
                    get_total_price();
                } else {
                    alert("库存不足");
                }

            });

            //减少数量
            $(".down").on('click',function(){
                value = $(this).next().val();
                up_value = parseInt(value) - 1;
                if(value != 1){
                    $(this).next().val(up_value)
                    get_total_price();
                }
            });

            $(".btnsaveorder").on('click',function(){
                if(!$("[name='agreement']").is(":checked")){
                    alert("请同意用户服务协议"); return false;
                }
                $("#order_form").submit();
            });

//            $("#yzm_code").blur(function(){
//                var yzm_code =  $("#yzm_code").val();
//                $.get("<{$config.weburl}>/ajax_back_end.php",{yzm:yzm_code},function(ret){
//                    if(ret === 'false'){
//                        alert("验证码错误");
//                    }
//                });
//            });

            $("#real_card_no").on('blur',function(){
                var real_card_type = $("#real_card_type").val();
                var real_card_no = $("#real_card_no").val();
                $.post("<{$config.weburl}>/ajax.php",{real_card_type:real_card_type,real_card_no:real_card_no,action:'check_card_no'},function(ret){
                   ret = eval('('+ret+')');
                    if(!ret.status){
                     alert(ret.msg);
                    }
                });
            });


            function check_data(){
                var delivery_way = $("[name='delivery_way']:checked").val();
                var ship_name = $("#ship_name").val();
                var ship_mobile = $("#ship_mobile").val();
                var provinceid = $("#provinceid").val();
                var cityid = $("#cityid").val();
                var areaid = $("#areaid").val();
                var ship_addr = $("#ship_addr").val();
                var yzm_code =  $("#yzm_code").val();
                var send_invoice = $("[name='send_invoice']:checked").val();
                if(delivery_way == 'express'){
                    if(ship_name == ''){
                        alert("请填写收货人信息");
                        return false;
                    }
                    if(ship_mobile == '') {
                        alert("请填写联系手机");
                        return false;
                    }
                    if(provinceid == '') {
                        alert("请选择省");
                        return false;
                    }
                    if(cityid == '') {
                        alert("请选择市");
                        return false;
                    }
                    if(areaid == '') {
                        alert("请选择区");
                        return false;
                    }
                    if(ship_addr == '') {
                        alert("请填写街道地址");
                        return false;
                    }
                }

                if(delivery_way == 'pickup'){
                    var pick_name = $("#pick_name").val();
                    var pick_mobile = $("#pick_mobile").val();
                    var pick_provinceid = $("#pick_provinceid").val();
                    var pick_addr = $("#pick_addr").val();
                    if(pick_name == ''){
                        alert("请填写取票人姓名");
                        return false;
                    }
                    if(pick_mobile == ''){
                        alert("请填写取票人联系手机");
                        return false;
                    }
                    if(pick_provinceid == ''){
                        alert("请选择取票城市");
                        return false;
                    }
                    if(pick_addr == ''){
                        alert("请填写取票地址");
                        return false;
                    }
                }


                <{if $parent_product.is_real_name == 1}>
                var real_user_name = $("#real_user_name").val();
                var real_card_type = $("#real_card_type").val();
                var real_card_no = $("#real_card_no").val();
                if(real_user_name == ''){
                    alert("请填写实名认证的姓名");
                    return false;
                }
                if(real_card_type == ''){
                    alert("请选择证件类型");
                    return false;
                }
                if(real_card_no == ''){
                    alert("请填写正价号码");
                    return false;
                }
               if(real_card_no != ''){
                   var real_card_type = $("#real_card_type").val();
                   var real_card_no = $("#real_card_no").val();
                   $.post("<{$config.weburl}>/ajax.php",{real_card_type:real_card_type,real_card_no:real_card_no,action:'check_card_no'},function(ret){
                       ret = eval('('+ret+')');
                       if(!ret.status){
                           alert(ret.msg);
                           return false;
                       } else {
                           return true;
                       }
                   });
               }



                <{/if}>

                if(send_invoice == 1){
                    var invoice_type = $("#invoice_type").val();
                    var invoice_company = $("#invoice_company").val();
                    var invoice_addr = $("#invoice_addr").val();
                    if(invoice_type == ''){
                        alert("请选择发票类型");
                        return false;
                    }
                    if(invoice_company == ''){
                        alert("请填写发票抬头");
                        return false;
                    }
                    if(invoice_addr == ''){
                        alert("请填写寄票地址");
                        return false;
                    }
                }
                return true;


            }

            //选择配送
            $(".kdps").on("click",function(){
                $(".express_way input").attr("checked","checked");
                $("#is_exp").show();
                $("#is_door").hide();
            });
            $(".smqp").on("click",function(){
                $(".pickup_way input").attr("checked","checked");
                $("#is_door").show();
                $("#is_exp").hide();
            });

        </script>
<{include file="footer.htm"}>

